export function getBytesLength(str) {
  console.log(str)
  var totalLength = 0;
  var i;
  var charCode;
  for (i = 0; i < str.length; i++) {
    charCode = str.charCodeAt(i);
    if (charCode < 0x007f) {
      totalLength = totalLength + 1;
    } else if ((charCode >= 0x0080) && (charCode <= 0x07ff)) {
      totalLength += 2;
    } else if ((charCode >= 0x0800) && (charCode <= 0xffff)) {
      totalLength += 3;
    }
  }
  return totalLength;
}
